[HEADER]
	VERSION		00.00.00.00
	DESCRIPTION 
	COPYRIGHT	Imagination Technologies Ltd.
[/HEADER]

[TEXTURES]
	FILE base 	lena.pvr		LINEAR-LINEAR-LINEAR
[/TEXTURES]

[VERTEXSHADER]
	NAME VertShader
	[GLSL_CODE]
		attribute highp   vec3 inVertex;
		attribute highp vec2 inTexCoord;
		
		varying highp vec4 Position;
		varying highp vec2 TexCoord;

		void main()
		{
			gl_Position = vec4(inVertex.x, inVertex.z, 0, 1.0);
			Position = gl_Position;
			TexCoord = vec2(inTexCoord.x, -inTexCoord.y);
		}
	[/GLSL_CODE]
[/VERTEXSHADER]

[FRAGMENTSHADER]
	NAME FragShader
	[GLSL_CODE]
		uniform sampler2D sTexture;
		uniform highp vec3 MousePosition;
		uniform highp vec2 ViewportSize;
		
		varying highp vec4 Position;
		varying highp vec2 TexCoord;
		
		void main()
		{
			highp float x = (2.0 * (MousePosition.x / ViewportSize.x) - 1.0) - Position.x;
			highp float y = (-2.0 * (MousePosition.y / ViewportSize.y) + 1.0)  - Position.y;
			
			highp float dist = sqrt(x*x + y*y);
			highp float magnitude = max(-dist * (dist - 0.4), 0.0);
			highp vec2 direction = normalize(vec2(x, y));
			highp vec2 displacement = direction * magnitude;

			gl_FragColor = texture2D(sTexture, TexCoord + displacement);
		}
	[/GLSL_CODE]
[/FRAGMENTSHADER]

[EFFECT] 
	NAME Effect

	ATTRIBUTE	inVertex		POSITION
	ATTRIBUTE	inTexCoord		UV0
	
	UNIFORM		MousePosition	MOUSEPOSITION
	UNIFORM		ViewportSize	VIEWPORTPIXELSIZE
	
	UNIFORM		sTexture		TEXTURE0
	TEXTURE 0 	base
	
	VERTEXSHADER VertShader
	FRAGMENTSHADER FragShader
[/EFFECT]